package util;

import java.io.*;

public class Reader_1 {
    public static void main(String[] args){
        // 流操作的第一步都是从File对象开始
        File file = new File("E:\\Demo1.java.txt");

        if(file.exists()){
            try {
                Reader r = new FileReader(file);
                int a = 0;
                while(a != -1){
                    a = r.read();
                    //char c = (char)a;
                    System.out.print((char)a);

                }

                r.close();

            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }else{
            System.out.println("文件不存在");
        }
    }
}
